package com.example.communitypro.controller;


import com.example.communitypro.pojo.Label;
import com.example.communitypro.service.LabelService;
import com.example.communitypro.util.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.stereotype.Controller;

@Controller
@RequestMapping("/label")
public class LabelController {
    @Autowired
    private LabelService labelService;

    @ResponseBody
    @RequestMapping(value = "/addLabel")
    @CrossOrigin
    public Result addLabel(Label record){
        return labelService.addLabel(record);
    }

    @ResponseBody
    @RequestMapping(value = "/dropLabel")
    @CrossOrigin
    public Result dropLabel(Integer labelNo){
        return labelService.dropLabel(labelNo);
    }
    @ResponseBody
    @RequestMapping(value = "/findAllLabel")
    @CrossOrigin
    public Result findAllLabel(){
        return labelService.findAllLabel();
    }

    @ResponseBody
    @RequestMapping(value = "/findLabelByRand")
    @CrossOrigin
    public Result findLabelByRand(){
        return labelService.findLabelByRand();
    }

}
